﻿Ext.define('MyApp.skating.Jump', {
    waltz: function () {
        console.log('Waltz: a one-half rotation jump that forms the basis for the axel jump.');
    },

    axel: function () {
        console.log('Axel: A single axel actually has 1.5 rotations');
    },

    split: function () {
        console.log('Split: With either a flip, lutz, or loop entry and split or straddle position in the air.');
    },

    combination: function () {
        console.log('This is a combination jump!');
    }
});

Ext.define("MyApp.skating.Spin", {
    scratch: function () {
        console.log("Scratch: With the free leg crossed in front of the skating leg.");
    },
    crossfoot: function () {
        console.log("Crossfoot: Is a back upright spin in which the free leg is crossed...");
    },
    camel: function () {
        console.log("Camel: Is a spin in which the free leg is held backwards with the knee higher than the hip level");
    },
    combination: function () {
        console.log('This is a combination spin!');
    }
});

Ext.define("MyApp.stepsequence.Footwork",{
    mohawk : function(){
        console.log("Mohawk: This sequence is usually done in the counterclockwise direction and on a circle or curve");
    },
    spreadeagle : function(){
        console.log("Spread eagle: The skater glides on both feet");
    },
    twizzles : function(){
        console.log("Twizzles: multirotational one-foot turns done in figure skating.");
    }
});

Ext.define('MyApp.single.Skater', {
    extend: 'Ext.util.Observable',
    mixins: {
        jump: 'MyApp.skating.Jump',
        spin: 'MyApp.skating.Spin',
        footwork: 'MyApp.stepsequence.Footwork'
    },
    constructor: function (options) {
        Ext.apply(this, options);
    },
    compete: function () {
        var me = this;
        console.log(me.name + ' from ' + me.nationality + ' starts the program! Good luck!');

        me.waltz();
        me.mohawk();
        me.camel();
        me.axel();
        me.spreadeagle();
        me.scratch();
        console.log(me.name + ' ends the program and gets the first place!');
    }

});

Ext.define('MyApp.dancing.Skater', {
    extend: 'Ext.util.Observable',
    mixins: {
        spin: 'MyApp.skating.Spin',
        footwork: 'MyApp.stepsequence.Footwork'
    },
    constructor: function (options) {
            Ext.apply(this, options);
        },
    compete : function () {
        var me=this;
        console.log(me.name + ' from '+ me.nationality + ' starts the program! Lets see how it goes...');
        me.camel();
        me.scratch();
        me.spreadeagle();
        me.twizzles();
        me.camel();
        console.log(me.name + ' end the program but with no good results :(');
    }

});

Ext.define('MyApp.data.Invoice', {
    config: {
        cliente: '',
        impuesto: 0.083,
        subtotal: 0,
        total: 0
    },
    constructor: function (config) {
        var me = this;
        me.initConfig(config);

    },

    applySubtotal: function (value) {
        var me = this;
        me.setTotal(value + value * me.getImpuesto());
        return value;
    }
});

Ext.define('MyApp.data.Client', {
    statics: {
        sequence: 0,
        nextId: function () {
            return ++this.sequence;
        }
    },

    constructor: function () {
        this.id = this.self.nextId();
        console.log(this.id);
    }
});

Ext.define('MyApp.Constants', {
    singleton : true,
    BASE_PATH : '/js',
    ATTEMPTS : 5,
    TIMEOUT : 6000
});

Ext.define('MyApp.abstract.Panel', {
    extend : 'Ext.panel.Panel',
    alias : 'widget.mypanel',
    title : 'Panel Abstracto',
    html : 'Contenido Principal'
});